#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main()
{
	FILE* pf = fopen("data.txt", "w");
	if (pf == NULL)
	{
		perror("fopen");
		return 1;
	}
	fputs("Hello World", pf);
	fclose(pf);
	FILE* pc = fopen("data.txt", "r");
	if (pc == NULL)
	{
		perror("fopen");
		return 1;
	}
	FILE* pp = fopen("data_copy.txt", "w");
	if (pp == NULL)
	{
		perror("fopen");
		return 1;
	}
	int ch;
	while ((ch = fgetc(pc)) != EOF)
	{
		fputc(ch, pp);
	}
	fclose(pc);
	fclose(pp);
	return 0;
}